<template>
  <component :is="iconComponent" />
</template>

<script lang="ts">
import { defineComponent, computed } from 'vue'
import * as Icons from '@ant-design/icons-vue'

export default defineComponent({
  props: {
    name: String
  },
  setup(props) {
    const iconComponent = computed(() => {
      // 将图标名称转换为 Ant Design 图标组件名称
      // 例如：ali_save -> SaveOutlined
      const iconName = props.name.replace('ali_', '')
      return Icons[iconName + 'Outlined'] || Icons[iconName]
    })

    return {
      iconComponent
    }
  }
})
</script>


